import copy

def sortInfoMain(dic):
  """
  排序抢注域名的信息
  :param dic: 当前抢注域名的 registered_info字典
  :return: 根据降序的用户ID列表, 抢注的信息字典
  """
  info_dic = eval(dic)
  totle = len(info_dic)
  if totle <= 0:
    return None, None
  info_option_dic = copy.deepcopy(info_dic)
  sort_keys_list = []
  for i in  range(totle):
    name = sortInfo(info_option_dic)
    sort_keys_list.append(name)
    info_option_dic.pop(name)
  return sort_keys_list, info_dic

def sortInfo(dic, type_n=0):
  """
  排序
  :param dic:
  :return: 最大的价格
  """
  keys_list = dic.keys()
  max_info_user_price, name = 0, ''
  for name_key in keys_list:
    user_reistered_info = dic[name_key]
    if int(user_reistered_info.get('price')) > max_info_user_price:
      max_info_user_price, name = int(user_reistered_info.get('price')), name_key
  max_info = dic[name]
  if type_n == 0:
    return name
  else:
    return max_info, name